<?php
namespace app\record\controller;

use app\common\base\BasicRest;
use think\Config;
use think\Db;
use think\Request;

class Record extends BasicRest
{
    public function search(Request $request){
        $data = $request->post();
        $page = $data['page'];
        $page_number = Config::get('page_number');
        //页数
        $count = Db::table('record')->count();
        $pages = $count/$page_number;
        $data1 = Db::table('record')->alias('r')
            ->join('userInfo','userInfo.id=r.uid','LEFT')
            ->field('r.id,userInfo.name,userInfo.identity,userInfo.county,userInfo.phone,r.reward')
            ->order('r.id desc')
            ->page($page,$page_number)
            ->select();
        if($data1) return res_success($data1,ceil($pages));
        return res_fail('未找到信息');
    }
}